 function getCookie(name) { 
    
    var arr;
    var reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
    if (arr = document.cookie.match(reg))
      return  decodeURI(arr[2]);
    else
      return null;
}
 function setCookie(name, value, day) {
  if(day !== 0){     //当设置的时间等于0时，不设置expires属性，cookie在浏览器关闭后删除
    var expires = day * 24 * 60 * 60 * 1000;
    var date = new Date(+new Date()+expires);
    document.cookie = name + "=" + encodeURI(value) + ";expires=" + date.toUTCString();
  }else{
    document.cookie = name + "=" + encodeURI(value);
  }
};
export  {getCookie,setCookie}